<template>
	<view class="feedback">
		<view class="feedback-wrap">
			<view class="uni-textarea">
				<textarea :value="data" @input="bindTextAreaBlur" placeholder="请输入投诉原因" />
			</view>
			<view class="feedback-btn">
				<button class="base-btn" @tap="onSubmit">提交投诉</button>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			id: '',
			data: ''
		};
	},
	onLoad (op) {
		this.id = op.id
	},
	methods: {
		 bindTextAreaBlur (e) {
            this.data = e.detail.value
        },
		onSubmit () {
			if (this.data.length < 1) {
				uni.showToast({
					title: '请输入投诉原因',
					icon: 'none'
				});
				return
			}
			uni.showLoading({
				title: '正在提交...'
			})
			this.$http.delorder({
				id: this.id,
				note: this.data
			}).then(res => {
				const data = res.data
				if (data.success) {
					uni.showToast({
						title: '投诉订单成功'
					});
					this.data = ''
					return
				}
				uni.showToast({
					title: data.errMsg,
					icon: 'none'
				});
			})
		}
	}
};
</script>

<style scoped lang="scss">
.feedback {
	&-wrap {
		padding: 60upx 40upx;
	}
	&-title {
		margin-bottom: 30upx;
		text-align: left;
		border-radius: 10upx;
		border: 2upx solid #3E527E;
		.input {
			padding: 15upx 20upx;
		}
	}
	height: 100vh;
	background-color: #fff;
	text-align: center;
	.uni-textarea {
		text-align: left;
		padding: 20upx;
		border-radius: 10upx;
		border: 2upx solid #3E527E;
	}
		
	&-btn {
		padding: 40upx 60upx;
	}
}
</style>
